/*
	设计一个圆类circle和一个桌子类table, 另外设计一个圆桌类roundtable, 它是从前两个类派生的，要求输出一个圆桌的高度、面积和颜色等数据.
*/
#include <iostream>
#include <cstring>

using namespace std;

#define PI 3.1415926535

class Circle {
	private:
		double radius;
		double area;
		char color[10];
	
	public:
		Circle(double r = 0){
			cout << "Constructing A Circle" << endl;
			radius = r;
			area = PI*radius*radius;
			strcpy(color, "white");
		}
		~Circle() { cout << "Deconstructing Circle..." << endl; };
		void setCircleRadius(double r);
		double getCircleRadius();
		double getCircleArea();
		void setCircleColor(const char * c);
	
		void show();

		friend ostream & operator << (ostream & stream, const Circle & obj);
};

void Circle::setCircleRadius(double r) {
	radius = r;
	area = PI * radius * radius;
}

double Circle::getCircleRadius() {
	return radius;
}

double Circle::getCircleArea() {
	return area;
}

void Circle::setCircleColor(const char * c) {
	strcpy(color, c);
}

void Circle::show() {
	cout << "Radius: " << radius << endl << "Area: " << area << endl << "Color: " << color << endl;
}

ostream & operator << (ostream & stream, const Circle & obj) {
	stream << "Radius: " << obj.radius << endl << "Area: " << obj.area << endl << "Color: " << obj.color;
	return stream;
}

class Table {
	private:
		double height;
		char shape[10];

	public:
		Table(double h, const char * s = "Square") {
			cout << "Constructing A table..." << endl;
			height = h;
			strcpy(shape, s);
		}
		~Table() {
			cout << "Deconstructing Table..." << endl;
		}
		void setTableHeight(const double h);
		double getTableHeight();
		void setTableShape(const char * s);

		void show();

		ostream & show_cout();

		friend ostream & operator << (ostream & stream, const Table & obj);
};

void Table::setTableHeight(const double h) {
	height = h;
}

double Table::getTableHeight() {
	return height;
}

void Table::show() {
	cout << "Height: " << height << endl << "Shape: " << shape << endl;
}

void Table::setTableShape(const char * s) {
	strcpy(shape, s);
}

ostream & operator << (ostream & stream, const Table & obj) {
	stream << "Height: " << obj.height << endl << "Shape: " << obj.shape;
	return stream;
}

class Roundtable:public Circle, public Table {
	private:
		double price;

	public:
		Roundtable(double r=10, double h=6, const char * s="Square", double price=100): Circle(r), Table(h, s) {
			cout << "Constructing A Roundtable..." << endl;
			price = price;
		} 
		~Roundtable() {
			cout << "Deconstructing Roundtable..." << endl;
		}
	
		void show();

		friend ostream & operator << (ostream & stream, const Roundtable & obj);
};

void Roundtable::show() {
	Circle::show();
	Table::show();
}

/*
ostream & operator << (ostream & stream, const Roundtable & obj) {
	stream << Circle::obj << endl << Table::obj;
	return stream;
}

*/
int main(int argc, char * argv[]) {
	
	Roundtable NewTable;

	NewTable.show();

	cout << endl << "Cout " << endl;

	// cout << NewTable << endl;

	return 0;
}
